package com.iflytek.ssm.usermanage.service.impl;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iflytek.ssm.usermanage.dao.UserMapper;
import com.iflytek.ssm.usermanage.entity.User;
import com.iflytek.ssm.usermanage.service.UserService;

@Service
public class UserServiceImpl implements UserService {

	private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);

	@Autowired
	private UserMapper userMapper;


	public User getByName(String name) {
		logger.info("getByName??name={}", name);
		return userMapper.getByName(name);
	}

	public User queryUserInfo(Integer id) {

		User user = userMapper.getById(id);

		if (user == null) {
			// ??�z
			user = new User();
			user.setAge(20);
			user.setId(0);
			user.setName("张三");

			return user;
		} else {
			// ?�z??
			return user;
		}

	}


}
